package com.carlwang.util;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class GetConnection {
	private static String DRIVER = "oracle.jdbc.OracleDriver";// com.mysql.jdbc.Driver//oracle.jdbc.OracleDriver//oracle.jdbc.driver.OracleDriver
	private static String USERNAME = "oryjk";
	private static String PASSWORD = "oryjkln";
	private static String URL = "jdbc:oracle:thin:@localhost:1521:orcl";// jdbc:oracle:thin:@localhost:1521:orcl//jdbc:mysql://localhost:3306/mydemo
	private static Connection conn;
	static {
		try {
			Class.forName(DRIVER);
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	public static Connection getConnection() {
		try {
			conn = DriverManager.getConnection(URL, USERNAME, PASSWORD);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return conn;
	}
}